package com.upf1sh.utils;


import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;

public class EmailCheck {

    public static boolean emailSend(String email,String code) {
        MailAccount mailAccount = new MailAccount();
        mailAccount.setHost("smtp.qq.com");
        mailAccount.setPort(Integer.valueOf(465));
        mailAccount.setAuth(true);
        //mailAccount.setSslEnable(true); // 开启 SSL 加密
        mailAccount.setFrom("1762827896@qq.com");
        mailAccount.setUser("1762827896@qq.com");
        mailAccount.setStarttlsEnable(true);
        mailAccount.setPass("qkzjddcomvmaccei");
        String text = "您的验证码为："+code;
        MailUtil.send(mailAccount,email,"验证码",text,false);
        return true;
    }

    public static void main(String[] args) {
        String mail = "1762827896@qq.com";
        String code = "1762827896@qq.com";
        boolean b = EmailCheck.emailSend(mail, code);
        System.out.println(b);
    }

}



